Method, system, and program for maintaining a directory for data written to a storage medium

ABSTRACT

Provided are a method, system, and program for encoding data onto a storage medium. Host data is received and a plurality of device blocks are generated to include the host data. A directory is generated including entries for physical locations on the storage medium, wherein each entry identifies one device block at the physical location corresponding to the entry, and wherein the directory is used to access data on the storage medium. The directory entries are encoded in the device blocks written to the storage medium.

BACKGROUND OF THE INVENTION

1. Field of the Invention

The present invention relates to a method, system, and program formaintaining a directory for data written to a storage medium.

2. Description of the Related Art

A host system writes data to tape in blocks of data referred to aslogical blocks. The tape drive will package one or more logical blocksinto one or more device blocks (also known as data sets) and write thedevice blocks sequentially to the tape medium. The data may be writtenin different patterns to the tape medium. On a helical scan tape, datais stored along vertical or diagonal tracks on the tape, on paralleltape data is stored on tracks in parallel during one scan on the tape,and on serpentine tape data is written in a forward and then reversedirection in a serpentine pattern across bands or tracks on the magnetictape medium. A serpentine tape drive first read/writes a track in aforward direction within a section of a band, referred to as a wrap,then read/writes the next track in a reverse direction, and so on,leading to a serpentine pattern for the data layout. In tape technology,a wrap comprises one of the bands that extend the entire length of thetape and a wrap section comprises a section of the wrap.

The tape drive controller maintains a tape directory that providesinformation on the device blocks at specific physical locations on tape.The tape directory has entries corresponding to specific physicallocations on the tape, where each entry indicates the device blocknumber, file mark count, logical block, and other information on thedata maintained at the physical location corresponding to the specificentry. In the event that the tape directory is corrupted, lost or isotherwise inaccessible, the tape drive controller must rebuild theentries in the tape directory.

This rebuild process is substantially time consuming because the tapedrive controller must rewind the tape to the beginning and then readeach device block to rebuild the tape directory entries before hosts mayaccess the tape. As the densities, capacities, and lengths of tape mediaincreases, the rebuild process needs to process an ever increasingamount of device blocks, thereby further increasing the time required torebuild the tape directory.

For these reasons, there is a need in the art for improved techniquesfor managing tape directories and reducing the time and operationsneeded to rebuild the tape directory.

SUMMARY OF THE PREFERRED EMBODIMENTS

Provided are a method, system, and program for encoding data onto astorage medium. Host data is received and a plurality of device blocksare generated to include the host data. A directory is generatedincluding entries for physical locations on the storage medium, whereineach entry identifies one device block at the physical locationcorresponding to the entry, and wherein the directory is used to accessdata on the storage medium. The directory entries are encoded in thedevice blocks written to the storage medium.

In further implementations, each directory entry indicates the host datain the device block at the physical location corresponding to the entry.

Still further, encoding the entries within the device blocks may beperformed for a current device block by determining a previous directoryentry encoded in a last device block written to the storage medium. Ifthe previous directory entry is a last entry in the directory, then afirst entry is encoded in the directory into the current device block.If the previous directory entry is not the last entry, then onedirectory entry following the previous directory entry is encoded intothe current device block.

Further provided are a method, system, and program for rebuilding adirectory having entries providing information on data written to astorage medium at corresponding physical locations of the storagemedium. A plurality of device blocks written to the storage medium areread, wherein each device block is encoded with at least one directoryentry. The directory entry encoded in the read device blocks is writteninto the tape directory to rebuild the tape directory.

Described implementations provide improved techniques for maintainingand rebuilding tape directory entries.

BRIEF DESCRIPTION OF THE DRAWINGS

Referring now to the drawings in which like reference numbers representcorresponding parts throughout:

FIG. 1 illustrates a computing environment in which aspects of theinvention are implemented;

FIG. 2 illustrate fields included in device blocks written to tapestorage in accordance with implementations of the invention;

FIG. 3 illustrates fields included in tape directory entries that areused with implementations of the invention;

FIG. 4 illustrates logic to generate device blocks and table directoryentries in accordance with implementations of the invention;

FIG. 5 illustrates an example of how device blocks are written to tapein accordance with implementations of the invention;

FIG. 6 illustrates logic to rebuild a tape directory in accordance withimplementations of the invention; and

FIG. 7 illustrates an architecture of computing components in thecomputing environment, such as the host and tape drive, and any othercomputing devices.

DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

In the following description, reference is made to the accompanyingdrawings which form a part hereof and which illustrate severalembodiments of the present invention. It is understood that otherembodiments may be utilized and structural and operational changes maybe made without departing from the scope of the present invention.

FIG. 1 illustrates an architecture of a tape storage system in whichaspects of the invention are implemented. A tape cartridge 2 includes ahigh capacity single reel of magnetic tape 4 and a non-volatileread/writable cartridge memory 6 which maintains information about theformat and layout of data on the magnetic tape. In furtherimplementations, the tape cartridge 2 may comprise a dual reel tapecartridge. In certain implementations, the tape cartridge 2, may includeaspects of the Linear Tape Open (LTO) Ultrium format.

The cartridge memory 6 includes a tape directory 8 that providesinformation on the data maintained at determinable physical locations onthe tape 4. In FIG. 1, the tape directory 8 is illustrated as includedin the cartridge memory 6 module that is separate from the tape 4. Inalternative implementations, the tape directory 8 may be stored on thetape 4, such as at the beginning of the tape 4.

The tape cartridge 2 may be inserted in a tape drive 10, that includesread/write heads (not shown) capable of transferring data to and fromthe magnetic tape 4 in a manner known in the art. The tape drive 10further includes one or more tape drive controllers 12 that receiveInput/Output (I/O) requests from a host system 20 and is capable ofexecuting the received I/O requests by rewinding the tape andpositioning the tape heads at a particular location on the magnetic tape4 using tape drive mechanisms and algorithms to estimate the likelylocation of a file on the tape 4 in a manner known in the art. The tapedrive 10 may be enclosed within the host system 20 or be a standaloneunit or in a tape library (not shown). The tape drive 10 may connectwith the host 20 through a direct interface, e.g., SCSI, Fibre Channel,etc., such as the case if the tape drive 10 is connected to the host 20or connect over a network, such as a Local Area Network (LAN), StorageArea Network (SAN), Wide Area Network (WAN), the Internet, an Intranet,etc.

The host 20 includes a host application 22, which may comprise a backupprogram, that transfers data to the tape drive 10 to sequentially writeto the magnetic tape 4. The host application 22 may utilize the SmallComputer System Interface (SCSI) tape commands to communicate I/Orequests to the tape drive 10, or any other data access command protocolknown in the art. To retrieve data records, the host application 22 mayread the magnetic tape 4 sequentially or in a random manner the magnetictape 4.

FIG. 2 illustrates fields that may be included in each device block 50stored on the tape 4 in accordance with implementations of theinvention. The device block 50 maintains control information 52, whichincludes information about the content of the device block, such as thenumber of logical blocks, identity of the logical blocks, number ofaccumulated file marks on tape (where a filemark delineates the end of afile such that the logical blocks between two file marks may comprise afile), etc. The control information 52 may include additional controlinformation known in the art. The device block 50 further includes oneor more table directory entry numbers 54 indicating the table directoryentry(s) that are stored within the device block 50. The content of thetable directory 8 entries identified in field 54 are also encoded withinthe device block 50 in field 56. In this way, the table directoryentries are distributed throughout the device blocks, such that one ormore table directory entries may be stored in one or more device blocks50. The device block 50 further includes one or more logical blocks 58.As discussed, one logical block may span multiple device blocks or onedevice block may include one or more logical blocks. An error correctioncode 60 is used to error check and correct the data maintained in thedevice block 50 on the tape 4.

FIG. 3 illustrates the fields that may be included in each tabledirectory entry 80, including:

-   -   Entry Number 82: This identifies the entry number in the table        directory 8. This value may be indirectly calculated.    -   Physical Location 84: identifies a physical location on tape        corresponding to the entry, such as a wrap number and location        within the wrap. If the physical locations for which entries are        maintained are at distances on the tape, i.e., at fixed offsets        from one another, then the physical location for an entry may be        inferred from the entry number. Physical locations may also be        based on criteria or selection other than fixed offsets or        distances from a previous physical location. The copending and        commonly assigned patent application entitled “Window Based        Directory for Magnetic Tape”, having U.S. application Ser. No.        10/178,715, filed on Jun. 25, 2002, which application is        incorporated herein by reference in its entirety, provides        further techniques for determining the physical locations.    -   Device Block Number 86: Identifies the device block number, also        known as data set, stored on tape at the physical location.    -   Logical Block Information 88: Identifies the logical block        stored on tape at the physical location. If there are multiple        logical blocks within a device block, then the logical block        identified in field 88 may be the logical block that spans or is        a first logical block starting in the referenced device block,        or the first logical block partially contained in the block.        Additional information about the referenced logical block may        also be included in this field, i.e., does the logical block        start or end in this data set, how many logical blocks are in        this data set, etc.    -   Filemark Count 90: is a cumulative value indicating the number        of file marks written on the tape 4 up to the point of the        physical location.

FIG. 4 illustrates logic implemented by the tape drive controller 12 togenerate device blocks 50 and information in the tape directory 8 inaccordance with implementations of the invention. Control begins atblock 100 when the tape drive 10 receives logical blocks from the hostapplication 22 to write to tape 4. In response, the tape drivecontroller 12 would build (at block 102) one or more device blocks 50(FIG. 2) in which to store the received logical blocks, including deviceblock control information 52. As mentioned one device block may includeone or more logical blocks or a logical block may span multiple deviceblocks. For each generated device block i, a loop is performed at blocks104 through 124. At block 106, a determination is made of the number ofthe tape directory entry written to the last written device block, whichmay be determined from field 54 of the last written device block ordetermined from a variable being maintained of the last written deviceblock. The determined entry number is incremented (at block 108) by one.If (at block 110) the incremented number is greater than the number ofentries in the tape directory 8, then the tape directory entry numberfield 54 is set (at block 112) to zero, or the number of the very firsttape directory 8 entry, and the first entry in the tape directory 8 isadded to the device block at field 56 (FIG. 2). Otherwise, if theincremented number is less than or equal to the number of entries in thetape directory 8, then the tape directory entry number field 54 is set(at block 114) to the incremented number, and the tape directory 8 entrycorresponding to the incremented number is added to the device block atfield 56 (FIG. 2). The error code 60 may further be generated at thispoint because the content of the device block i has been generated.

With the above logic, tape directory 8 entries are written sequentiallyto device blocks, and when the last entry in the tape directory 8 iswritten to a device block, the tape drive controller 12 cycles back tothe first entry in the tape directory 8 to write the first entry to thenext device block. In this way, the tape directory entries arerepeatedly written sequentially to the device blocks, thereby repeatedlydistributing the tape directory 8 entries throughout the device blockswritten to tape 4.

After block 112 or 114, the built device block i is then written (atblock 116) to tape 4 following last written device block. Alternatively,the content of the device block may be written as the content is beinggenerated. If (at block 120) the device block i spans a physicallocation corresponding to the next entry to add to the tape directory 8,then the tape drive controller 12 appends (at block 122) a new entry tothe tape directory 8 indicating the physical location spanned by deviceblock i, identification of device block i, and identification of thefirst logical block following or spanning the physical locationcorresponding to this added entry. As mentioned, the physical locationscorresponding to tape directory 8 entries may be at known equally spacedintervals from the start of the tape, e.g., such as a fixed number ofphysical locations per wrap, etc., and thus capable of being inferred.Alternatively, a list or index of physical locations may be provided.From the no branch of block 120 or from block 122, control returns (toblock 122) to block 104 to process any further generated device blocks.

With the logic of FIG. 4, each device block includes only one tapedirectory entry. In alternative implementations, multiple tape directoryentries may be written to each device block. In such implementations,the algorithm of FIG. 4 would have to be adjusted to accommodate thatmultiple entries are in each device block. For instance, the deviceblock entry 50 would need to include multiple table directory entrynumbers and the corresponding multiple entries. In furtherimplementations, algorithms other than simple incrementing may be used.Such algorithms may have different recovery connotations. For instance,with simple incrementing, N sequential blocks are read to recover theentire directory. Alternatively, with the incrementing algorithm,reading N/2 sequential device blocks recovers a sequential half of thedirectory (i.e., first half, last half or middle half, etc.), dependingon the starting point, representing only a sequential half of thewritten data on the tape. Using alternative algorithms, reading N/2sequential device blocks still recovers half the directory, but nowcontains directory entries containing reference points distributedacross the entire written data on the tape (i.e., every other entry,etc.), albeit with further distance between reference points.

FIG. 5 illustrates an example of tape directory entries (TD) encoded indevice blocks (DBs). In the example of FIG. 5, device blocks are offixed length and there are four device blocks in each region bounded bytwo adjacent physical locations for which there are correspondingentries in the tape directory 8. The device blocks (DBs) aresequentially written to tape. Using the logic of FIG. 4, in the firstregion, there is only one entry, entry 0. Thus, only the tape directoryentry zero (TD0) is repeatedly written to the device blocks in region 0.The first device block in entry 1 would include the data for the tabledirectory for entry one (TD1). Since TD1 is the last entry, the next onerecorded is TD0, and the two entries will be alternated for the rest ofthe region. As shown in FIG. 5, using the logic of FIG. 4, as moreentries are added to the tape directory 8, there are additional entriesto be encoded in the device blocks being written to tape. In this way,table directory entries are continually distributed throughout thedevice blocks being written to tape 4. Although in FIG. 5 each regionhas a same number of device blocks, in alternative implementations,different regions of the tape may have a different number of deviceblocks or data sets, and the regions may have a different physical andlogical size.

FIG. 6 illustrates logic implemented in the tape drive controller 12 torebuild the tape directory 8 in the event that the tape directory 8becomes corrupted, damaged or is otherwise inaccessible. Control beginsat block 200 when the tape drive controller 12 initiates a process torebuild the tape directory 8. The tape drive controller 12 determines(at block 202) the last written device block on the tape 4 anddetermines (at block 204) the number of physical locations correspondingto tape entries between the beginning of the tape 4 to the end of thelast written device block, e.g., end of tape 4. In alternativeimplementations, the rebuild may not be performed with respect to theentire full tape, but only for a certain area of interest on the tape.In such case, instead of determining the last written device block, atblock 202, the determination may be of the last block of interest or thenearest block after the target block for a locate/append operation.Further, as discussed, the physical locations may be at fixed locationsor intervals starting from the beginning of the tape.

After determining the number of physical locations, the tape drivecontroller 12 sets (at block 206) a variable N to the determined numberof physical locations, which is also the number of entries that will berebuilt in the tape directory 8. As discussed, entries in the tapedirectory 8 are generated when a device block is written across thephysical locations corresponding to the directory entry. The controller12 then moves (at block 208) the tape read/write head to the last deviceblock on the tape 4 and then moves (at block 210) the head back N minusone device blocks from the last device block and accesses this deviceblock that is N device blocks from the end of the tape. In alternativeimplementations, the tape read/write head may be located to the end ofthe tape and begin reading backwards N data sets until the directory isrebuilt or locate the tape read/write head to a calculated position atleast N data sets before the last data set and rebuild data sets in aforward direction. Still further, the head may be placed upstream of theend of the tape or at another position. The method selected for locatingthe read/write head to rebuild data sets may be determined by thecapabilities of the drive or the recording format or the physicalproximity to the starting and ending point of this area of tape toprocess. In certain instances, performing a short locate then a read mayhave better performance than locating the tape read/write headphysically across the area to be read.

The tape directory entry number 54 (FIG. 2) in the accessed device blockis determined (at block 212). If (at block 214) the entry in the tapedirectory 8 at the determined entry number does not have an entry, i.e.,is empty, then the tape drive controller 12 enters (at block 216) thetape directory entry 56 (FIG. 2) encoded in the accessed device block tothe determined entry number in the tape directory 8, thereby recoveringthe tape directory entry from the device block. Alternatively, alreadyfilled entries in the tape directory 8 may be overwritten, therebyeliminating the need to determine an entry number that is entry.

When accessing the device block, the tape drive controller 12 furtherdetermines (at block 220) whether the accessed device block spans aphysical location for which there is a corresponding entry in the tapedirectory 8. If so, then the tape drive controller 12 determines (atblock 222) the tape directory entry number corresponding to the physicallocation and adds (at block 224) an entry 80 (FIG. 3) to the tapedirectory 12 for the determined entry number, indicating the spannedphysical location 84, information 86 identifying the device blockspanning the physical location, information 88 identifying the firstlogical block in the device block at or following the spanned physicallocation, etc. If (at block 226) the tape head is not currentlyaccessing the last device block on the tape 4 (or an end of an area ofinterest, such as a first block on tape, first or last block in an areaof interest, etc.), then the tape drive controller 12 moves (at block228) the tape or tape head to the next device block on the tape 4 andreturns to block 228 to recover a device block entry from the nextdevice block. In alternative implementations, the tape may be movedforwards (i+1) or backwards (i−1). If (at block 226) the tape head iscurrently accessing the last device block on tape 4, then control ends.

With the logic of FIG. 6, the tape drive controller 12 rebuilds tapedirectory entries from entries encoded into the device blocks. Further,with the described logic of FIG. 6, the tape drive controller need onlyread a limited number of device blocks from the end of the tape thatinclude the number of entries in the tape directory. In implementationswhere multiple tape directory entries are encoded in each device block,the tape drive controller 12 would read a number of device blocks fromthe end of tape that is less than the number of directory entries, andmost likely substantially less than the number of device blocks on thetape. This is an improvement over the prior art where tape drivecontrollers read every device block on tape to rebuild the tapedirectory. Moreover, when accessing the last N device blocks to rebuildthe tape directory (where N corresponds to the number of entries in thetape directory to rebuild, or less), the tape drive controller wouldrebuild entries in the tape directory when reading a device block thatspans a physical location corresponding to an entry. This ensures thatall entries are rebuilt in the case later added directory 8 entries werenot encoded in device blocks written to tape.

Additional Implementation Details

The described techniques for maintaining tape directory information maybe implemented as a method, apparatus or article of manufacture usingstandard programming and/or engineering techniques to produce software,firmware, hardware, or any combination thereof. The term “article ofmanufacture” as used herein refers to code or logic implemented inhardware logic (e.g., an integrated circuit chip, Programmable GateArray (PGA), Application Specific Integrated Circuit (ASIC), etc.) or acomputer readable medium, such as magnetic storage medium (e.g., harddisk drives, floppy disks, tape, etc.), optical storage (CD-ROMs,optical disks, etc.), volatile and non-volatile memory devices (e.g.,EEPROMs, ROMs, PROMs, RAMs, DRAMs, SRAMs, firmware, programmable logic,etc.). Code in the computer readable medium is accessed and executed bya processor. The code in which preferred embodiments are implemented mayfurther be accessible through a transmission media or from a file serverover a network. In such cases, the article of manufacture in which thecode is implemented may comprise a transmission media, such as a networktransmission line, wireless transmission media, signals propagatingthrough space, radio waves, infrared signals, etc. Thus, the “article ofmanufacture” may comprise the medium in which the code is embodied.Additionally, the “article of manufacture” may comprise a combination ofhardware and software components in which the code is embodied,processed, and executed. Of course, those skilled in the art willrecognize that many modifications may be made to this configurationwithout departing from the scope of the present invention, and that thearticle of manufacture may comprise any information bearing medium knownin the art.

In the described implementations, data was organized into wrap sectionsin the user data sections. In alternative implementations, the data inthe user data sections may be organized into physically consecutivegroups of tracks other than wrap sections.

In described implementations, logical blocks from a host were stored ina device block having specific fields. In alternative implementations,the device blocks including the logical blocks stored on tape may havedifferent fields or additional fields to those described above.

The described implementations provide a technique for transferring datato a tape drive. Additionally, the above described logic may be usedwith other input/output (I/O) devices or other storage devices, e.g.,optical tape.

The described implementations utilized serpentine Linear Tape Open (LTO)technology. In alternative implementations, alternative tapetechnologies may be used, such as helical-scan tape drive thatread/write vertical or diagonal tracks on the tape using a rotatingread/write head and parallel tape drives that read/write tracks inparallel during one scan through the tape. The described implementationsmay be utilized with Digital Linear Tape (DLT), Quarter Inch Cassette(QIC), Travan, and any other tape technology known in the art.

The logic implementation of FIGS. 4 and 6 described specific operationsas occurring in a particular order. In alternative implementations,certain of the logic operations may be performed in a different order,modified or removed and still implement preferred embodiments of thepresent invention. Morever, steps may be added to the above describedlogic and still conform to implementations of the invention.

FIG. 7 illustrates one implementation of a computer architecture 300that may be used in the host 20 and tape driver 10 (FIG. 1). Thearchitecture 300 may include a processor 302 (e.g., a microprocessor), amemory 304 (e.g., a volatile memory device), and storage 306 (e.g., anon-volatile storage, such as magnetic disk drives, optical disk drives,a tape drive, etc.). The storage 306 may comprise an internal storagedevice or an attached or network accessible storage. Programs in thestorage 306 are loaded into the memory 304 and executed by the processor302 in a manner known in the art. The architecture further includes anetwork card 308 to enable communication with a network. An input device310 is used to provide user input to the processor 302, and may includea keyboard, mouse, pen-stylus, microphone, touch sensitive displayscreen, or any other activation or input mechanism known in the art. Anoutput device 312 is capable of rendering information transmitted fromthe processor 302, or other component, such as a display monitor,printer, storage, etc.

The foregoing description of the preferred embodiments of the inventionhas been presented for the purposes of illustration and description. Itis not intended to be exhaustive or to limit the invention to theprecise form disclosed. Many modifications and variations are possiblein light of the above teaching. It is intended that the scope of theinvention be limited not by this detailed description, but rather by theclaims appended hereto. The above specification, examples and dataprovide a complete description of the manufacture and use of thecomposition of the invention. Since many embodiments of the inventioncan be made without departing from the spirit and scope of theinvention, the invention resides in the claims hereinafter appended.

1. A method for encoding data onto a storage medium, comprising:receiving host data; generating a plurality of device blocks to includethe host data; generating a directory including entries for physicallocations on the storage medium, wherein each of a plurality of thedirectory entries identifies one device block at the physical locationcorresponding to the entry, wherein the directory is used to access dataon the storage medium; encoding the directory entries in the deviceblocks; writing the device blocks to the storage medium; and if onedevice block is written to one physical location, then adding one entryto the directory for the physical location to which the device block iswritten identifying the written device block, wherein the addeddirectory entry is encoded into at least one device block subsequentlywritten to the storage medium.
 2. The method of claim 1, wherein each ofthe plurality of the directory entries indicates the host data in thedevice block at the physical location corresponding to the entry.
 3. Themethod of claim 1, further comprising: for each entry encoded within onedevice block, encoding a number of the directory entry within the deviceblock.
 4. The method of claim 1, wherein each of the plurality of thedirectory entries is encoded into a plurality of device blocks.
 5. Themethod of claim 1, wherein at least one directory entry is encoded intoeach device block.
 6. The method of claim 1, wherein the storage mediumcomprises magnetic tape, and wherein the device blocks are writtensequentially to the magnetic tape.
 7. A method for encoding data onto astorage medium, comprising: receiving host data; generating a pluralityof device blocks to include the host data; generating a directoryincluding entries for physical locations on the storage medium, whereineach of a plurality of the directory entries identifies one device blockat the physical location corresponding to the entry, wherein thedirectory is used to access data on the storage medium; encoding thedirectory entries within the device blocks written to the storage mediumfor a current device block by: determining a previous directory entryencoded in a last device block written to the storage medium; if theprevious directory entry is a last entry in the directory, then encodinga first entry in the directory into the current device block; and if theprevious directory entry is not the last entry, then encoding onedirectory entry following the previous directory entry into the currentdevice block.
 8. A method for rebuilding a directory having entriesproviding information on data written to a storage medium atcorresponding physical locations of the storage medium, comprising:determining a number of physical locations to which device blocks arewritten on the storage medium; reading a number of device blocks writtento the storage medium that include a number of directory entries equalto the determined number of physical locations, wherein the deviceblocks are encoded with at least one directory entry; and writing thedirectory entry encoded in the read device blocks into the directory torebuild the directory.
 9. The method of claim 8, wherein at least onedirectory entry is encoded in each device block, wherein the number ofread device blocks is equal to or less than the determined number ofphysical locations.
 10. The method of claim 8, wherein reading deviceblocks comprises reading a plurality of device blocks sequentially froma last written device block to the storage medium.
 11. The method ofclaim 8, further comprising: determining whether the read device blocksspan one physical location; generating a directory entry for thephysical location spanned by the read device block including informationon the read device block if the read device block spans one physicallocation; and adding the generated directory entry to the directory. 12.A system for encoding data, comprising: a storage medium; means forreceiving host data; means for generating a plurality of device blocksto include the host data; means for generating a directory includingentries for physical locations on the storage medium, wherein each of aplurality of the directory entries identifies one device block at thephysical location corresponding to the entry, wherein the directory isused to access data on the storage medium; means for encoding thedirectory entries in the device blocks; means for writing the deviceblocks to the storage medium; and means for adding one entry to thedirectory for the physical location to which the device block is writtenidentifying the written device block if one device block is written toone physical location, wherein the added directory entry is encoded intoat least one device block subsequently written to the storage medium.13. The system of claim 12, wherein each of the plurality of directoryentries indicates the host data in the device block at the physicallocation corresponding to the entry.
 14. A system for encoding data,comprising: a storage medium; means for receiving host data; means forgenerating a plurality of device blocks to include the host data; meansfor generating a directory including entries for physical locations onthe storage medium, wherein each of a plurality of the directory entriesidentifies one device block at the physical location corresponding tothe entry, wherein the directory is used to access data on the storagemedium; means for encoding the directory entries within the deviceblocks written to the storage medium by: determining a previousdirectory entry encoded in a last device block written to the storagemedium; if the previous directory entry is a last entry in thedirectory, then encoding a first entry in the directory into the currentdevice block; and if the previous directory entry is not the last entry,then encoding one directory entry following the previous directory entryinto the current device block.
 15. A system, comprising: a storagemedium; an information bearing medium including a directory havingentries providing information on data written to the storage medium atcorresponding physical locations of the storage medium; means fordetermining a number of physical locations to which device blocks arewritten on the storage medium; means for reading a number of deviceblocks written to the storage medium that include a number of directoryentries equal to the determined number of physical locations, whereinthe device blocks are encoded with at least one directory entry; andmeans for writing the directory entry encoded in the read device blocksinto the directory to rebuild the directory.
 16. A device for encodingdata onto a storage medium, wherein the device causes operations to beperformed, the operations comprising: receiving host data; generating aplurality of device blocks to include the host data; generating adirectory including entries for physical locations on the storagemedium, wherein each of a plurality of the directory entries identifiesone device block at the physical location corresponding to the entry,wherein the directory is used to access data on the storage medium;encoding the directory entries in the device blocks; writing the deviceblocks to the storage medium; and if one device block is written to onephysical location, then adding one entry to the directory for thephysical location to which the device block is written identifying thewritten device block, wherein the added directory entry is encoded intoat least one device block subsequently written to the storage medium.17. The device of claim 16, wherein each of the plurality of thedirectory entries indicates the host data in the device block at thephysical location corresponding to the entry.
 18. The device of claim16, further comprising: for each entry encoded within one device block,encoding a number of the directory entry within the device block. 19.The device of claim 16, wherein each of the plurality of directoryentries is encoded into a plurality of device blocks.
 20. The device ofclaim 16, wherein at least one directory entry is encoded into eachdevice block.
 21. The device of claim 16, wherein the storage mediumcomprises magnetic tape, and wherein the device blocks are writtensequentially to the magnetic tape.
 22. A device for encoding data onto astorage medium, wherein the device causes operations to be performed,the operations comprising: receiving host data; generating a pluralityof device blocks to include the host data; generating a directoryincluding entries for physical locations on the storage medium, whereineach of a plurality of the directory entries identifies one device blockat the physical location corresponding to the entry, wherein thedirectory is used to access data on the storage medium; encoding thedirectory entries within the device blocks written to the storage mediumfor a current device block by: determining a previous directory entryencoded in a last device block written to the storage medium; if theprevious directory entry is a last entry in the directory, then encodinga first entry in the directory into the current device block; and if theprevious directory entry is not the last entry, then encoding onedirectory entry following the previous directory entry into the currentdevice block.
 23. A device implementing code for rebuilding a directoryhaving entries providing information on data written to a storage mediumat corresponding physical locations of the storage medium, wherein thecode is executed to cause operations to be performed, the operationscomprising: reading a plurality of device blocks written to the storagemedium sequentially from a last written device block to the storagemedium, wherein the device blocks are encoded with at least onedirectory entry and host data; and writing the directory entry encodedin the read device blocks into the directory to rebuild the directory.24. The device of claim 23, wherein the operations further comprise:determining whether the read device blocks span one physical location;generating a directory entry for the physical location spanned by theread device block including information on the read device block if theread device block spans one physical location; and adding the generateddirectory entry to the directory.
 25. A device implementing code forrebuilding a directory having entries providing information on datawritten to a storage medium at corresponding physical locations of thestorage medium, wherein the code is executed to cause operations to beperformed, the operations comprising: determining a number of physicallocations to which device blocks are written on the storage medium;reading a number of device blocks written to the storage medium thatinclude a number of directory entries equal to the determined number ofphysical locations, wherein the device blocks are encoded with at leastone directory entry; and writing the directory entry encoded in the readdevice blocks into the directory to rebuild the directory.
 26. Thedevice of claim 25, wherein at least one directory entry is encoded ineach device block, wherein the number of read device blocks is equal toor less than the determined number of physical locations.